package com.source.multithread.thread;

/**
 * @Author wengqy
 * @Date 2020/12/19
 */
public class ThreadDemo {
    public static void main(String[] args) throws InterruptedException {
        Th th1 = new Th("AA");
     //   th1.setName("AA");

        th1.start();

        Th th2 = new Th("BB");
        th2.start();
 //       th2.setName("BB");
        Thread.sleep(10);
        Th th3 = new Th();
        th3.start();
        th3.setName("CC");

        for (int i = 1; i <=5 ; i++) {

            System.out.println(Thread.currentThread().getName()+"-----"+i);
        }
    }
}

class Th extends  Thread{

    public Th(String name){
        super(name);
    }

    public Th( ){
        super( );
    }
    @Override
    public void run() {
        for (int i = 1; i <=10 ; i++) {
            System.out.println(Thread.currentThread().getName()+"-----------"+i);
        }
    }
}